<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>伪类nth</title>
    <style>
        .box1 p {
            height: 20px;
            background-color: orange;
            border: solid 2px black;
        }
        .box1 div {
            height:50px;
            background-color: pink;
            border: dashed 5px black;
        }
        .box1 p:nth-child(2){
            width: 200px;
            height: 200px;
            background-color: palegoldenrod;
        }
        .box1 p:nth-of-type(2){
            width: 200px;
            height: 200px;
            background-color: palegreen;
        }
        .p1 {
            height: 30px;
            background-color: olivedrab;
            border: 1px solid;
        }
        p:nth-child(3){
            background-color: orchid !important;
        }
    </style>
</head>
<body>
    <div class="box1">
        <p>1</p>
        <div>2</div>
        <p>3</p>
        <p>4</p>
    </div>
    <p class="p1">1</p>
    <p class="p1">2</p>
    <p class="p1">3</p>
</body>
<script>
    const doms = document.querySelector('p')
    console.log(doms)
    console.log('getComputedStyle(doms)', getComputedStyle(doms).width)
</script>
</html>